#!/bin/zsh
# -*-coding: latin-1;-*-

##########################################################
#
# title:     autoload modules config file
#
# filename:  /etc/zsh/autoload
#
# author(s): Alessandro Molari (mola89.molarulez.com),
#            Luca Molari
#
# license:   This file is licensed under the GPLv2
#            For more informations read:
#            http://www.gnu.org/licenses/gpl-2.0.txt
#
# thanks to: zsh team (www.zsh.org)
#            grml team (grml.org)
#            Michael Prokop (mika@grml.org)
#
##########################################################



# programmable rename
autoload -U zmv

# don't want to quote/escape URLs on our own
autoload -U url-quote-magic
zle -N self-insert url-quote-magic
zstyle ':url-quote-magic:*' url-metas '*?[]^()~#{}='

# load colors
autoload -U colors
colors

# load completion system
autoload -U compinit
compinit

# load prompt
autoload -U promptinit
promptinit

# load zmv, making the rename programmable
autoload -U zmv

# load zed
autoload -U zed

# load history-search-end
autoload -U history-search-end

# load complist deltochar and mathfunct
for mod in complist deltochar mathfunc ; do
    zmodload -i zsh/${mod} 2>/dev/null || print "No ${mod} available"
done

# autoload zsh modules when they're referenced
tmpargs=(
    a   stat
    a   zpty
    ap  mapfile
)
while (( ${#tmpargs} > 0 )) ; do
    zmodload -${tmpargs[1]} zsh/${tmpargs[2]} ${tmpargs[2]}
    shift 2 tmpargs
done
unset tmpargs

# load edit command line
autoload -U edit-command-line
zle -N edit-command-line

# load insert files
autoload -U insert-files
zle -N insert-files
